#include "test_sig_gen.h"
#include <math.h>
#include <stdio.h>

uint16_t hr_list[]={81,
84,85,86,85,86,87,88,89,90,89,88,89,90,89,88,89,90,91,
90,91,92,93,94,95,96,95,94,93,94,93,92,91,90,91,91,92,92
}; 
int32_t _hr_len =  sizeof(hr_list)/sizeof(hr_list[0]);
const float u_2pi = 6.2831853f;
int32_t test_sig_gen_hr_dy(uint16_t *int_val,uint32_t _length,uint32_t *step_index)
{

    float hr_freq=0.0f; 
    float ssample_ts = u_2pi/50.0f; /// 采样间隔
    float samp_period = 0.0f;
    float end_val= 0.0f;
    uint16_t perid_cnt=0;
    for (int32_t i = 0; i < _length ; i++)
    {
        hr_freq = (float)hr_list[i]/60.0f; /// 生成频率
        samp_period = 4.0f/hr_freq*u_2pi;
        perid_cnt = (uint16_t)(samp_period/ssample_ts);
        for(uint16_t j = 0; j < perid_cnt; j++)
        {
            end_val = (sinf(hr_freq*j*ssample_ts)+1.1f)*300+30000;
            printf("%d\n",(int32_t)(end_val));
        }
    }
    return 0;
}
